<%@ page contentType="text/html;charset=utf-8" %>
<%@ page import="java.sql.Connection,org.h2.Driver,java.sql.DriverManager,java.sql.ResultSet,java.sql.Statement" session="false" %>
<html>
<body>
	<%
	    out.write("hello world!");
		Statement stmt;
		Class.forName("org.h2.Driver").newInstance();
		//String url = "jdbc:h2:tcp://localhost/~/test";
		String url = "jdbc:h2:./db/test";
		String user = "sa";
		String password = "";
		Connection conn = DriverManager.getConnection(url, user, password);
		ResultSet recset;
		stmt = conn.createStatement();
		stmt.executeUpdate("drop table  testjdbc if exists"); 
		stmt.executeUpdate("create table  testjdbc (id number NOT NULL auto_increment,name varchar(12))"); 
	    stmt.executeUpdate("insert into  testjdbc     values(null, 'Tom')"); 
	    stmt.executeUpdate("insert into  testjdbc     values(null, 'Terry')"); 
		stmt = conn.createStatement();
		recset = stmt.executeQuery("select * from testjdbc");
		while (recset.next()) {
			out.write("<br>id=" + recset.getString("id") + ",名字="
					+ recset.getString("NAME"));
		}
		recset.close();
		stmt.close();
		conn.close();
	%>

</body>
</html>